<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateUserOauthTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('user_oauth', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger('user_id')->comment('用户ID');
            $table->unsignedBigInteger('shop_id')->comment('店铺ID');
            $table->string('openid', 50)->comment('OPENID');
            $table->string('unionid', 50)->nullable()->comment('UNIONID');
            $table->unsignedInteger('is_login')->default(0)->comment('是否登录|["否","是"]');
            $table->timestampsTz();
            $table->comment('用户授权表');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('user_oauth');
    }
}
